package com.hand.exam.controller;

import com.hand.exam.annoction.PermissionAnnoction;
import com.hand.exam.annoction.TestAnnoction;
import com.hand.exam.domain.Matter;
import com.hand.exam.service.IMatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 马旭阳
 * @date2019/7/20
 */
@RestController
@RequestMapping(value = "/matter")
public class MatterController {
    @Autowired
    private IMatterService matterService;
    @GetMapping(value = "/{id}")
    @PermissionAnnoction(value = true)
    @TestAnnoction(value = true)
    public Matter queryMatterById(@PathVariable("id") Long id){

        return matterService.queryMatterById(id);
    }
    @GetMapping(value = "/more")
    @PermissionAnnoction(value = true)
    @TestAnnoction(value = true)
    public Matter queryMatter(@RequestBody Matter matter){
        System.out.println("aa");
        return matterService.queryMatter(matter);
    }
    @PostMapping
    @TestAnnoction(value = true)
    public void insertMatter(@RequestBody Matter matter){

        matterService.insertMatter(matter);
    }
    @PutMapping
    @TestAnnoction(value = true)
    public void updateMatter(@RequestBody Matter matter){
        matterService.updateMatter(matter);
    }
    @DeleteMapping
    @TestAnnoction(value = true)
    public void deleteMatter(@RequestParam("id") Long id){
        matterService.deleteMatter(id);
    }

}
